
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>JavaScript概念之screenclientoffsetscrollinneravail的widthleft · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="js获取星期几.html" />
    
    
    <link rel="prev" href="JavaScript setInterval函数详解.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../cmd命令.html">
            
                <a href="../cmd命令.html">
            
                    
                    cmd命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="Array.prototype.slice.call.html">
            
                <a href="Array.prototype.slice.call.html">
            
                    
                    Array.prototype.slice.call解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="async 函数.html">
            
                <a href="async 函数.html">
            
                    
                    async 函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="callback&&callback如果存在回调函数就执行.html">
            
                <a href="callback&&callback如果存在回调函数就执行.html">
            
                    
                    callback&&callback() 如果存在回调函数就执行！
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="CSS3 nth-child使用注意.html">
            
                <a href="CSS3 nth-child使用注意.html">
            
                    
                    CSS3 nth-child(n)使用注意
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="css3的 -webkit-min-device-pixel-ratio属性 解决高清的适配.html">
            
                <a href="css3的 -webkit-min-device-pixel-ratio属性 解决高清的适配.html">
            
                    
                    css3的 -webkit-min-device-pixel-ratio属性 解决高清的适配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="CSS文本超出自动缩小字体.html">
            
                <a href="CSS文本超出自动缩小字体.html">
            
                    
                    CSS文本超出自动缩小字体
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="element-ui默认样式修改.html">
            
                <a href="element-ui默认样式修改.html">
            
                    
                    element-ui默认样式修改
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="JavaScript setInterval函数详解.html">
            
                <a href="JavaScript setInterval函数详解.html">
            
                    
                    JavaScript setInterval() 函数详解
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.11" data-path="JavaScript概念之screenclientoffsetscrollinneravail的widthleft.html">
            
                <a href="JavaScript概念之screenclientoffsetscrollinneravail的widthleft.html">
            
                    
                    JavaScript概念之screenclientoffsetscrollinneravail的widthleft
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="js获取星期几.html">
            
                <a href="js获取星期几.html">
            
                    
                    js获取星期几
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="js监听滚动条事件和获取浏览器及屏幕高度和宽度等信息的方法.html">
            
                <a href="js监听滚动条事件和获取浏览器及屏幕高度和宽度等信息的方法.html">
            
                    
                    js监听滚动条事件和获取浏览器及屏幕高度和宽度等信息的方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="js时间戳与日期格式之间相互转换.html">
            
                <a href="js时间戳与日期格式之间相互转换.html">
            
                    
                    js时间戳与日期格式之间相互转换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="JS数组reduce方法详解及高级技巧.html">
            
                <a href="JS数组reduce方法详解及高级技巧.html">
            
                    
                    JS数组reduce()方法详解及高级技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="js中获取时间new Date详细介绍.html">
            
                <a href="js中获取时间new Date详细介绍.html">
            
                    
                    js中获取时间new Date()详细介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="less传参问题：在url中插入变量今天在需要用less给url传递参数时遇到了小问题，一番搜索后有了下述解决方法.html">
            
                <a href="less传参问题：在url中插入变量今天在需要用less给url传递参数时遇到了小问题，一番搜索后有了下述解决方法.html">
            
                    
                    less传参问题：在url中插入变量今天在需要用less给url传递参数时遇到了小问题，一番搜索后有了下述解决方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="moment 和date-fns.html">
            
                <a href="moment 和date-fns.html">
            
                    
                    moment 和date-fns
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.19" data-path="node.JS中配置http-server.html">
            
                <a href="node.JS中配置http-server.html">
            
                    
                    node.JS中配置http-server
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20" data-path="Object.keys详解.html">
            
                <a href="Object.keys详解.html">
            
                    
                    Object.keys详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.21" data-path="router-link各种属性解释.html">
            
                <a href="router-link各种属性解释.html">
            
                    
                    router-link各种属性解释
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.22" data-path="stylus使用介绍.html">
            
                <a href="stylus使用介绍.html">
            
                    
                    stylus使用介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23" data-path="TypeError Cannot read property 'compilation' of undefined.html">
            
                <a href="TypeError Cannot read property 'compilation' of undefined.html">
            
                    
                    TypeError Cannot read property 'compilation' of undefined
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.24" data-path="Vue  keep-alive.html">
            
                <a href="Vue  keep-alive.html">
            
                    
                    Vue  keep-alive
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.25" data-path="Vue - 过渡与动画transition.html">
            
                <a href="Vue - 过渡与动画transition.html">
            
                    
                    Vue - 过渡与动画transition
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.26" data-path="vue-axios使用方法.html">
            
                <a href="vue-axios使用方法.html">
            
                    
                    vue-axios使用方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.27" data-path="vue-calendar-component.html">
            
                <a href="vue-calendar-component.html">
            
                    
                    vue-calendar-component
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.28" data-path="vue-infinite-loading.html">
            
                <a href="vue-infinite-loading.html">
            
                    
                    vue-infinite-loading
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29" data-path="vue报错There are multiple modules with names that only differ in casing.html">
            
                <a href="vue报错There are multiple modules with names that only differ in casing.html">
            
                    
                    vue报错There are multiple modules with names that only differ in casing
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30" data-path="Vue中注意target和currentTarget的使用.html">
            
                <a href="Vue中注意target和currentTarget的使用.html">
            
                    
                    Vue中注意target和currentTarget的使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.31" data-path="关于给javascript对象添加、删除、修改对象的属性.html">
            
                <a href="关于给javascript对象添加、删除、修改对象的属性.html">
            
                    
                    关于给javascript对象添加、删除、修改对象的属性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.32" data-path="获取当前地址坐标.html">
            
                <a href="获取当前地址坐标.html">
            
                    
                    获取当前地址坐标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.33" data-path="解决ajax跨域问题【5种解决方案】.html">
            
                <a href="解决ajax跨域问题【5种解决方案】.html">
            
                    
                    解决ajax跨域问题【5种解决方案】
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.34" data-path="解决vue-cli webpack打包后加载资源的路径问题.html">
            
                <a href="解决vue-cli webpack打包后加载资源的路径问题.html">
            
                    
                    解决vue-cli webpack打包后加载资源的路径问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.35" data-path="时间格式转换：201971转换为2019-7-1.html">
            
                <a href="时间格式转换：201971转换为2019-7-1.html">
            
                    
                    时间格式转换：201971转换为2019-7-1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.36" data-path="数据库密码改了.html">
            
                <a href="数据库密码改了.html">
            
                    
                    数据库密码改了
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.37" data-path="语法getBoundingClientRect.html">
            
                <a href="语法getBoundingClientRect.html">
            
                    
                    语法getBoundingClientRect()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.38" data-path="在js中使用length报错Error in renderTypeErrorcannot read property bgImg of null.html">
            
                <a href="在js中使用length报错Error in renderTypeErrorcannot read property bgImg of null.html">
            
                    
                    在js中使用length报错Error in renderTypeErrorcannot read property bgImg of null
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >JavaScript概念之screenclientoffsetscrollinneravail的widthleft</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="javascript&#x6982;&#x5FF5;&#x4E4B;screenclientoffsetscrollinneravail&#x7684;widthleft">JavaScript&#x6982;&#x5FF5;&#x4E4B;screen/client/offset/scroll/inner/avail&#x7684;width/left</h1>
<p><a href="http://caibaojian.com/js-name.html" target="_blank">http://caibaojian.com/js-name.html</a></p>
<p>js&#x4E2D;&#x83B7;&#x53D6;&#x5404;&#x79CD;&#x5BBD;&#x5EA6;&#x548C;&#x8DDD;&#x79BB;&#xFF0C;&#x5E38;&#x5E38;&#x8BA9;&#x6211;&#x4EEC;&#x6DF7;&#x6DC6;&#xFF0C;&#x5404;&#x79CD;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x4E0D;&#x517C;&#x5BB9;&#x8BA9;&#x6211;&#x4EEC;&#x5F88;&#x5934;&#x75BC;&#xFF0C;&#x73B0;&#x5728;&#x5C31;&#x5728;&#x8BF4;&#x8BF4;js&#x4E2D;&#x6709;&#x54EA;&#x4E9B;&#x5BBD;&#x5EA6;&#x548C;&#x8DDD;&#x79BB;&#x3002;</p>
<h2 id="1&#x3001;&#x540D;&#x8BCD;&#x89E3;&#x91CA;">1&#x3001;&#x540D;&#x8BCD;&#x89E3;&#x91CA;</h2>
<ul>
<li><strong>screen</strong>&#xFF1A;&#x5C4F;&#x5E55;&#x3002;&#x8FD9;&#x4E00;&#x7C7B;&#x53D6;&#x5230;&#x7684;&#x662F;&#x5173;&#x4E8E;&#x5C4F;&#x5E55;&#x7684;&#x5BBD;&#x5EA6;&#x548C;&#x8DDD;&#x79BB;&#xFF0C;&#x4E0E;&#x6D4F;&#x89C8;&#x5668;&#x65E0;&#x5173;&#xFF0C;&#x5E94;&#x8BE5;&#x662F;&#x83B7;&#x53D6;window&#x5BF9;&#x8C61;&#x7684;&#x5C5E;&#x6027;&#x3002;</li>
<li><strong>client</strong>&#xFF1A;&#x4F7F;&#x7528;&#x533A;&#x3001;&#x5BA2;&#x6237;&#x533A;&#x3002;&#x6307;&#x7684;&#x662F;&#x5BA2;&#x6237;&#x533A;&#xFF0C;&#x5F53;&#x7136;&#x662F;&#x6307;&#x6D4F;&#x89C8;&#x5668;&#x533A;&#x57DF;&#x3002;</li>
<li><strong>offset</strong>&#xFF1A;&#x504F;&#x79FB;&#x3002;&#x6307;&#x7684;&#x662F;&#x76EE;&#x6807;&#x7532;&#x76F8;&#x5BF9;&#x76EE;&#x6807;&#x4E59;&#x7684;&#x8DDD;&#x79BB;&#x3002;</li>
<li><strong>scroll</strong>&#xFF1A;&#x5377;&#x8F74;&#x3001;&#x5377;&#x52A8;&#x3002;&#x6307;&#x7684;&#x662F;&#x5305;&#x542B;&#x6EDA;&#x52A8;&#x6761;&#x7684;&#x7684;&#x5C5E;&#x6027;&#x3002;</li>
<li><strong>inner</strong>&#xFF1A;&#x5185;&#x90E8;&#x3002;&#x6307;&#x7684;&#x662F;&#x5185;&#x90E8;&#x90E8;&#x5206;&#xFF0C;&#x4E0D;&#x542B;&#x6EDA;&#x52A8;&#x6761;&#x3002;</li>
<li><strong>avail</strong>&#xFF1A;&#x53EF;&#x7528;&#x7684;&#x3002;&#x53EF;&#x7528;&#x533A;&#x57DF;&#xFF0C;&#x4E0D;&#x542B;&#x6EDA;&#x52A8;&#x6761;&#xFF0C;&#x6613;&#x4E0E;inner&#x6DF7;&#x6DC6;&#x3002;</li>
</ul>
<h2 id="2&#x3001;window">2&#x3001;window</h2>
<h2 id="21&#x3001;windowinnerwidthinnerheight">2.1&#x3001;window.innerWidth/innerHeight</h2>
<p>&#x63CF;&#x8FF0;&#xFF1A;&#x6D4F;&#x89C8;&#x5668;&#x53EF;&#x89C1;&#x533A;&#x57DF;&#x7684;&#x5185;&#x5BBD;&#x5EA6;&#x3001;&#x9AD8;&#x5EA6;&#xFF08;&#x4E0D;&#x542B;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x8FB9;&#x6846;&#xFF0C;&#x4F46;&#x5305;&#x542B;&#x6EDA;&#x52A8;&#x6761;&#xFF09;&#x3002;</p>
<p>&#x517C;&#x5BB9;&#xFF1A;ie9/10&#x3001;chrome&#x3001;firefox&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF08;&#x7F29;&#x653E;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x5BBD;&#x5EA6;&#x4E3A;1000px&#xFF0C;&#x9AD8;&#x5EA6;&#x4E3A;500px&#xFF09;&#xFF1A;</p>
<pre><code>alert(window.innerWidth);
// chrome/firefox/ie9/10=&gt;1000
// ie6/7/8=&gt;undefined
alert(window.innerHeight);
// chrome/firefox/ie9/10=&gt;500
// ie6/7/8=&gt;undefined
</code></pre><h2 id="22&#x3001;windowouterwidthouterheight">2.2&#x3001;window.outerWidth/outerHeight</h2>
<p>&#x63CF;&#x8FF0;&#xFF1A;&#x6D4F;&#x89C8;&#x5668;&#x5916;&#x5BBD;&#x5EA6;&#xFF08;&#x5305;&#x542B;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x8FB9;&#x6846;&#xFF0C;&#x56E0;&#x5404;&#x4E2A;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x8FB9;&#x6846;&#x8FB9;&#x4E00;&#x6837;&#xFF0C;&#x5F97;&#x5230;&#x7684;&#x503C;&#x4E5F;&#x662F;&#x4E0D;&#x4E00;&#x6837;&#x7684;&#xFF09;&#x3002;</p>
<p>&#x517C;&#x5BB9;&#xFF1A;ie9/10&#x3001;chrome&#x3001;firefox&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF08;&#x7F29;&#x653E;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x5BBD;&#x5EA6;&#x4E3A;1000px&#xFF0C;&#x9AD8;&#x5EA6;&#x4E3A;500px&#xFF09;&#xFF1A;</p>
<pre><code>alert(window.outerWidth);
// chrome/firefox/ie9/10=&gt;1002
// ie6/7/8=&gt;undefined
alert(window.outerHeight);
// chrome/firefox/ie9/10=&gt;502
// ie6/7/8=&gt;undefined
</code></pre><p><strong>&#x6CE8;&#x610F;&#xFF1A;</strong>&#x6CA1;&#x6709;window.width&#x5C5E;&#x6027;&#x3002;</p>
<h2 id="23&#x3001;windowscreenleftscreentop">2.3&#x3001;window.screenLeft/screenTop</h2>
<p>&#x63CF;&#x8FF0;&#xFF1A;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x4F4D;&#x79FB;&#xFF0C;&#x8868;&#x793A;&#xFF1A;</p>
<ul>
<li>ie&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x5185;&#x8FB9;&#x7F18;&#x8DDD;&#x79BB;&#x5C4F;&#x5E55;&#x8FB9;&#x7F18;&#x7684;&#x8DDD;&#x79BB;&#x3002;</li>
<li>chrome&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x5916;&#x8FB9;&#x7F18;&#x8DDD;&#x79BB;&#x5C4F;&#x5E55;&#x8FB9;&#x7F18;&#x7684;&#x8DDD;&#x79BB;&#x3002;</li>
</ul>
<p>&#x5982;&#x56FE;&#xFF1A;</p>
<p><img src="http://pic.caibaojian.com/uploads/2015/01/1478463313-8274.jpg" alt="1478463313-8274"></p>
<p>&#x517C;&#x5BB9;&#xFF1A;ie6/7/8/9/10&#x3001;chrome&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF1A;</p>
<pre><code class="lang-javascript">alert(<span class="hljs-built_in">window</span>.screenLeft);
<span class="hljs-comment">// ie=&gt;87</span>
<span class="hljs-comment">// chrome=&gt;86</span>
<span class="hljs-comment">// firefox=&gt;undefined</span>

alert(<span class="hljs-built_in">window</span>.screenTop);
<span class="hljs-comment">// ie=&gt;87</span>
<span class="hljs-comment">// chrome=&gt;86</span>
<span class="hljs-comment">// firefox=&gt;undefined</span>
</code></pre>
<h2 id="24&#x3001;windowscreenxscreeny">2.4&#x3001;window.screenX/screenY</h2>
<p>&#x63CF;&#x8FF0;&#xFF1A;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x4F4D;&#x79FB;&#xFF0C;&#x8868;&#x793A;&#xFF1A;</p>
<ul>
<li>ie9/10&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x5916;&#x8FB9;&#x7F18;&#x8DDD;&#x79BB;&#x5C4F;&#x5E55;&#x8FB9;&#x7F18;&#x7684;&#x8DDD;&#x79BB;&#x3002;</li>
<li>chrome&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x5916;&#x8FB9;&#x7F18;&#x8DDD;&#x79BB;&#x5C4F;&#x5E55;&#x8FB9;&#x7F18;&#x7684;&#x8DDD;&#x79BB;&#x3002;</li>
</ul>
<p>&#x7531;&#x6B64;&#x53EF;&#x77E5;&#xFF0C;chrome&#x7684;screenLeft&#x548C;screenX&#x662F;&#x76F8;&#x7B49;&#x7684;&#xFF08;&#x5176;&#x76EE;&#x7684;&#x662F;&#x4E3A;&#x4E86;&#x517C;&#x5BB9;ie&#x548C;firefox&#xFF0C;&#x4E24;&#x4E2A;&#x5C5E;&#x6027;&#x90FD;&#x517C;&#x5907;&#x4E86;&#xFF0C;&#x4F46;&#x66F4;&#x8D8B;&#x5411;&#x4E8E;firefox&#xFF0C;chrome&#x7684;&#x8FD9;&#x79CD;&#x505A;&#x6CD5;&#x4E0D;&#x6B62;&#x8FD9;&#x4E00;&#x5904;&#xFF0C;&#x8FD8;&#x6709;&#x5F88;&#x591A;&#xFF0C;&#x5176;&#x5B9E;&#x8FD9;&#x79CD;&#x505A;&#x6CD5;&#x4FBF;&#x4E8E;&#x5F00;&#x53D1;&#x8005;&#x79FB;&#x690D;&#xFF0C;&#x4F46;&#x5BF9;&#x5F00;&#x53D1;&#x8005;&#x7684;&#x5F00;&#x53D1;&#x8FC7;&#x7A0B;&#x4EA7;&#x751F;&#x4E86;&#x4E00;&#x5B9A;&#x7684;&#x6DF7;&#x6DC6;&#xFF09;&#xFF0C;ie9/10&#x7684;screenLeft&#x662F;&#x5927;&#x4E8E;screenX&#x7684;&#xFF0C;&#x5982;&#x56FE;&#xFF1A;</p>
<p>&#x3010;&#x56FE;&#x3011;</p>
<p>&#x517C;&#x5BB9;&#xFF1A;ie9/10&#x3001;chrome&#x3001;firefox&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF1A;</p>
<pre><code class="lang-javascript">alert(<span class="hljs-built_in">window</span>.screenX);
<span class="hljs-comment">// chrome/firefox=&gt;86</span>
<span class="hljs-comment">// ie9/10=&gt;79</span>
<span class="hljs-comment">// ie6/7/8=&gt;undefined</span>

alert(<span class="hljs-built_in">window</span>.screenY);
<span class="hljs-comment">// chrome/firefox=&gt;86</span>
<span class="hljs-comment">// ie9/10=&gt;79</span>
<span class="hljs-comment">// ie6/7/8=&gt;undefined</span>
</code></pre>
<h2 id="25&#x3001;windowpagexoffsetpageyoffset">2.5&#x3001;window.pageXOffset/pageYOffset</h2>
<p>&#x63CF;&#x8FF0;&#xFF1A;&#x8868;&#x793A;&#x6D4F;&#x89C8;&#x5668;X&#x8F74;&#xFF08;&#x6C34;&#x5E73;&#xFF09;&#x3001;Y&#x8F74;&#xFF08;&#x5782;&#x76F4;&#xFF09;&#x6EDA;&#x52A8;&#x6761;&#x7684;&#x504F;&#x79FB;&#x8DDD;&#x79BB;&#x3002;</p>
<p>&#x517C;&#x5BB9;&#xFF1A;ie9/10&#x3001;chrome&#x3001;firefox&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">document</span>.onclick=<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
    alert(<span class="hljs-built_in">window</span>.pageXOffset);
    <span class="hljs-comment">// chrome=&gt;200</span>
    <span class="hljs-comment">// firefox=&gt;200</span>
    <span class="hljs-comment">// ie9/10=&gt;200</span>
    <span class="hljs-comment">// ie6/7/8=&gt;undefined</span>
    alert(<span class="hljs-built_in">window</span>.pageYOffset);
    <span class="hljs-comment">// chrome=&gt;200</span>
    <span class="hljs-comment">// firefox=&gt;200</span>
    <span class="hljs-comment">// ie9/10=&gt;200</span>
    <span class="hljs-comment">// ie6/7/8=&gt;undefined</span>
};
</code></pre>
<h2 id="26&#x3001;windowscrollxscrolly">2.6&#x3001;window.scrollX/scrollY</h2>
<p>&#x63CF;&#x8FF0;&#xFF1A;&#x8868;&#x793A;&#x6D4F;&#x89C8;&#x5668;X&#x8F74;&#xFF08;&#x6C34;&#x5E73;&#xFF09;&#x3001;Y&#x8F74;&#xFF08;&#x5782;&#x76F4;&#xFF09;&#x6EDA;&#x52A8;&#x6761;&#x7684;&#x504F;&#x79FB;&#x8DDD;&#x79BB;&#x3002;&#x7531;&#x6B64;&#x53EF;&#x77E5;&#xFF0C;&#x5728;chrome&#x548C;firefox&#x4E2D;window.pageXOffset&#x548C;window.scrollX&#x662F;&#x76F8;&#x7B49;&#x7684;&#xFF0C;&#x5177;&#x4F53;&#x4E3A;&#x4EC0;&#x4E48;&#x4F1A;&#x51FA;&#x73B0;&#x4E24;&#x4E2A;&#x76F8;&#x7B49;&#x7684;&#x5C5E;&#x6027;&#x503C;&#xFF0C;&#x4E0D;&#x5F97;&#x800C;&#x77E5;&#x3002;</p>
<p>&#x517C;&#x5BB9;&#xFF1A;chrome&#x3001;firefox&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">document</span>.onclick=<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
    alert(<span class="hljs-built_in">window</span>.scrollX);
    <span class="hljs-comment">// chrome=&gt;200</span>
    <span class="hljs-comment">// firefox=&gt;200</span>
    <span class="hljs-comment">// ie6/7/8/9/10=&gt;undefined</span>

    alert(<span class="hljs-built_in">window</span>.scrollY);
    <span class="hljs-comment">// chrome=&gt;200</span>
    <span class="hljs-comment">// firefox=&gt;200</span>
    <span class="hljs-comment">// ie6/7/8/9/10=&gt;undefined</span>
};
</code></pre>
<h2 id="3&#x3001;screen">3&#x3001;screen</h2>
<h2 id="31&#x3001;screenwidthheight">3.1&#x3001;screen.width/height</h2>
<p>&#x63CF;&#x8FF0;&#xFF1A;&#x5C4F;&#x5E55;&#x7684;&#x5BBD;&#x5EA6;&#x3001;&#x9AD8;&#x5EA6;&#xFF08;&#x6307;&#x7684;&#x662F;&#x5C4F;&#x5E55;&#x7684;&#x5206;&#x8FA8;&#x7387;&#xFF0C;&#x5355;&#x4F4D;&#x4E3A;&#x50CF;&#x7D20;&#xFF09;&#x3002;</p>
<p>&#x517C;&#x5BB9;&#x6027;&#xFF1A;ie6/7/8/9/10&#x3001;chrome&#x3001;firefox&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF08;&#x5C4F;&#x5E55;&#x7684;&#x5206;&#x8FA8;&#x7387;&#x4E3A;1440&#xD7;900&#xFF09;&#xFF1A;</p>
<pre><code class="lang-javascript">alert(screen.width);
<span class="hljs-comment">// chrome/firefox/ie6/7/8/9/10=&gt;1440</span>
alert(screen.height);
<span class="hljs-comment">// chrome/firefox/ie6/7/8/9/10=&gt;900</span>
</code></pre>
<p><strong>&#x6CE8;&#x610F;&#xFF1A;</strong>&#x6B64;&#x5904;&#x5FC5;&#x987B;&#x662F;screen.width&#xFF0C;&#x800C;&#x4E0D;&#x662F;screenWidth&#xFF0C;&#x4E0E;&#x63A5;&#x4E0B;&#x6765;&#x8981;&#x8BF4;&#x7684;&#x5404;&#x79CD;&#x5BBD;&#x5EA6;&#x6709;&#x6240;&#x533A;&#x522B;&#x3002;</p>
<h2 id="32&#x3001;screenavailwidthavailheight">3.2&#x3001;screen.availWidth/availHeight</h2>
<p>&#x63CF;&#x8FF0;&#xFF1A;&#x5C4F;&#x5E55;&#x7684;&#x53EF;&#x7528;&#x5BBD;&#x5EA6;&#x3001;&#x9AD8;&#x5EA6;&#xFF08;&#x901A;&#x5E38;&#x4E0E;&#x5C4F;&#x5E55;&#x7684;&#x5BBD;&#x5EA6;&#x3001;&#x9AD8;&#x5EA6;&#x4E00;&#x81F4;&#xFF09;&#x3002;</p>
<p>&#x517C;&#x5BB9;&#x6027;&#xFF1A;ie6/7/8/9/10&#x3001;chrome&#x3001;firefox&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF1A;</p>
<pre><code class="lang-javascript">alert(screen.availWidth);
<span class="hljs-comment">// chrome/firefox/ie6/7/8/9/10=&gt;1440</span>
alert(screen.availHeight);
<span class="hljs-comment">// chrome/firefox/ie6/7/8/9/10=&gt;900</span>
</code></pre>
<h2 id="4&#x3001;element">4&#x3001;element</h2>
<p>&#x5143;&#x7D20;&#x7684;&#x5BBD;&#x5EA6;&#x3001;&#x4F4D;&#x79FB;&#x3001;&#x8DDD;&#x79BB;&#x4EE5;&#x5143;&#x7D20;&#x7684;&#x76D2;&#x6A21;&#x578B;&#x4E3A;<code>content-box</code>&#x4E3A;&#x4F8B;&#x3002;&#x5373;&#xFF1A;</p>
<pre><code class="lang-javascript">box-sizing: content-box;
</code></pre>
<p>&#x5176;&#x4ED6;&#x76D2;&#x6A21;&#x578B;&#x8BA1;&#x7B97;&#x4F1A;&#x6709;&#x5DEE;&#x5F02;&#xFF0C;&#x8BF7;&#x52FF;&#x5BF9;&#x53F7;&#x5165;&#x5EA7;&#x3002;</p>
<h2 id="41&#x3001;elmentclientwidthclientheight">4.1&#x3001;elment.clientWidth/clientHeight</h2>
<p>&#x63CF;&#x8FF0;&#xFF1A;&#x8BA1;&#x7B97;&#x5982;&#x4E0B;&#xFF0C;</p>
<ul>
<li>&#x6709;&#x6EDA;&#x52A8;&#x6761;&#x65F6;&#xFF1A;clientWidth=&#x5143;&#x7D20;&#x5DE6;&#x5185;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;+&#x5143;&#x7D20;&#x5BBD;&#x5EA6;+&#x5143;&#x7D20;&#x53F3;&#x5185;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;-&#x5143;&#x7D20;&#x5782;&#x76F4;&#x6EDA;&#x52A8;&#x6761;&#x5BBD;&#x5EA6;</li>
<li>&#x65E0;&#x6EDA;&#x52A8;&#x6761;&#x65F6;&#xFF1A;clientWidth=&#x5143;&#x7D20;&#x5DE6;&#x5185;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;+&#x5143;&#x7D20;&#x5BBD;&#x5EA6;+&#x5143;&#x7D20;&#x53F3;&#x5185;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;</li>
</ul>
<p>&#x4F7F;&#x7528;&#x8BE5;&#x7279;&#x6027;&#x53EF;&#x4EE5;&#x8BA1;&#x7B97;&#x51FA;&#x7684;&#x6EDA;&#x52A8;&#x6761;&#x5BBD;&#x5EA6;&#xFF08;&#x5373;&#x8BBE;&#x7F6E;&#x5143;&#x7D20;&#x7684;&#x5185;&#x5BB9;&#x5BBD;&#x5EA6;&#x8D85;&#x8FC7;&#x5143;&#x7D20;&#x5BBD;&#x5EA6;&#xFF0C;&#x7136;&#x540E;&#x5206;&#x522B;&#x8BBE;&#x7F6E;&#x662F;&#x5426;&#x8D85;&#x8FC7;&#x9690;&#x85CF;&#xFF0C;&#x4E24;&#x6B21;&#x7684;clientWidth&#x5DEE;&#x503C;&#x5C31;&#x662F;&#x6EDA;&#x52A8;&#x6761;&#x7684;&#x5BBD;&#x5EA6;&#xFF09;&#x3002;</p>
<p>&#x517C;&#x5BB9;&#xFF1A;chrome&#x3001;firefox&#x3001;ie6/7/8/9/10&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF08;&#x5BBD;&#x5EA6;&#x548C;&#x9AD8;&#x5EA6;&#x90FD;&#x4E3A;100px&#xFF0C;&#x8FB9;&#x6846;&#x4E3A;50px&#xFF0C;&#x5185;&#x8FB9;&#x8DDD;&#x4E3A;60px&#xFF0C;&#x5916;&#x8FB9;&#x8DDD;&#x4E3A;70px&#xFF0C;&#x5DE6;&#x3001;&#x4E0A;&#x4F4D;&#x79FB;&#x4E3A;80px&#xFF0C;&#x6EDA;&#x52A8;&#x6761;&#x7684;&#x5BBD;&#x5EA6;&#x56E0;&#x7CFB;&#x7EDF;&#x4E0D;&#x540C;&#x800C;&#x4E0D;&#x540C;&#xFF09;&#xFF1A;</p>
<p><img src="http://pic.caibaojian.com/uploads/2015/01/1478463314-4928.jpg" alt="1478463314-4928"></p>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x6709;&#x6EDA;&#x52A8;&#x6761;=&gt;paddingLeftWidth+width+paddingRightWidth-scrollYWidth</span>
<span class="hljs-comment">// &#x65E0;&#x6EDA;&#x52A8;&#x6761;=&gt;paddingLeftWidth+width+paddingRightWidth</span>
alert(oDemo.clientWidth);
<span class="hljs-comment">// &#x6709;&#x6EDA;&#x52A8;&#x6761;=&gt;60+100+60-17=203</span>
<span class="hljs-comment">// &#x65E0;&#x6EDA;&#x52A8;&#x6761;=&gt;60+100+60=220</span>

<span class="hljs-comment">// &#x6709;&#x6EDA;&#x52A8;&#x6761;=&gt;paddingTopWidth+height+paddingBottomWidth-scrollYHeight</span>
<span class="hljs-comment">// &#x65E0;&#x6EDA;&#x52A8;&#x6761;=&gt;paddingTopWidth+height+paddingBottomWidth</span>
alert(oDemo.clientHeight);
<span class="hljs-comment">// &#x6709;&#x6EDA;&#x52A8;&#x6761;=&gt;60+100+60-17=203</span>
<span class="hljs-comment">// &#x65E0;&#x6EDA;&#x52A8;&#x6761;=&gt;60+100+60=220</span>
</code></pre>
<h2 id="42&#x3001;elementclientleftclienttop">4.2&#x3001;element.clientLeft/clientTop</h2>
<p>&#x63CF;&#x8FF0;&#xFF1A;clientLeft&#x4E3A;&#x5DE6;&#x8FB9;&#x6846;&#x5BBD;&#x5EA6;&#xFF0C;clientTop&#x4E3A;&#x4E0A;&#x8FB9;&#x6846;&#x5BBD;&#x5EA6;&#x3002;</p>
<p>&#x517C;&#x5BB9;&#xFF1A;chrome&#x3001;firefox&#x3001;ie6/7/8/9/10&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF08;&#x5BBD;&#x5EA6;&#x548C;&#x9AD8;&#x5EA6;&#x90FD;&#x4E3A;100px&#xFF0C;&#x8FB9;&#x6846;&#x4E3A;50px&#xFF0C;&#x5185;&#x8FB9;&#x8DDD;&#x4E3A;60px&#xFF0C;&#x5916;&#x8FB9;&#x8DDD;&#x4E3A;70px&#xFF0C;&#x5DE6;&#x3001;&#x4E0A;&#x4F4D;&#x79FB;&#x4E3A;80px&#xFF0C;&#x6EDA;&#x52A8;&#x6761;&#x7684;&#x5BBD;&#x5EA6;&#x56E0;&#x7CFB;&#x7EDF;&#x4E0D;&#x540C;&#x800C;&#x4E0D;&#x540C;&#xFF09;&#xFF1A;</p>
<p><img src="http://pic.caibaojian.com/uploads/2015/01/1478463315-6448.jpg" alt="1478463315-6448"></p>
<pre><code class="lang-javascript"><span class="hljs-comment">// borderLeftWidth</span>
alert(oDemo.clientLeft);
<span class="hljs-comment">// =&gt;50</span>

<span class="hljs-comment">// borderTopWidth</span>
alert(oDemo.clientTop);
<span class="hljs-comment">// =&gt;50</span>
</code></pre>
<h2 id="43&#x3001;elementoffsetwidthoffsetheight">4.3&#x3001;element.offsetWidth/offsetHeight</h2>
<p>&#x63CF;&#x8FF0;&#xFF1A;offsetWidth=&#x5143;&#x7D20;&#x5DE6;&#x8FB9;&#x6846;&#x5BBD;&#x5EA6;+&#x5143;&#x7D20;&#x5DE6;&#x5185;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;+&#x5143;&#x7D20;&#x5BBD;&#x5EA6;+&#x5143;&#x7D20;&#x53F3;&#x5185;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;+&#x5143;&#x7D20;&#x53F3;&#x8FB9;&#x6846;&#x5BBD;&#x5EA6;&#x3002;</p>
<p>&#x517C;&#x5BB9;&#xFF1A;chrome&#x3001;firefox&#x3001;ie6/7/8/9/10&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF08;&#x5BBD;&#x5EA6;&#x548C;&#x9AD8;&#x5EA6;&#x90FD;&#x4E3A;100px&#xFF0C;&#x8FB9;&#x6846;&#x4E3A;50px&#xFF0C;&#x5185;&#x8FB9;&#x8DDD;&#x4E3A;60px&#xFF0C;&#x5916;&#x8FB9;&#x8DDD;&#x4E3A;70px&#xFF0C;&#x5DE6;&#x3001;&#x4E0A;&#x4F4D;&#x79FB;&#x4E3A;80px&#xFF0C;&#x6EDA;&#x52A8;&#x6761;&#x7684;&#x5BBD;&#x5EA6;&#x56E0;&#x7CFB;&#x7EDF;&#x4E0D;&#x540C;&#x800C;&#x4E0D;&#x540C;&#xFF09;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// borderLeftWidth+paddingLeftWidth+width+paddingRightWidth+borderRightWidth</span>
alert(oDemo.offsetWidth);
<span class="hljs-comment">// =&gt;50+60+100+60+50=320</span>

<span class="hljs-comment">// borderTopWidth+paddingLeftWidth+width+paddingRightWidth+borderRightWidth</span>
alert(oDemo.offsetWidth);
<span class="hljs-comment">// =&gt;50+60+100+60+50=320</span>
</code></pre>
<h2 id="44&#x3001;elementoffsetleftoffsettop">4.4&#x3001;element.offsetLeft/offsetTop</h2>
<p>&#x63CF;&#x8FF0;&#xFF1A;&#x8868;&#x793A;&#x8BE5;&#x5143;&#x7D20;&#x76F8;&#x5BF9;&#x4E8E;&#x6700;&#x8FD1;&#x7684;&#x5B9A;&#x4F4D;&#x7956;&#x5148;&#x5143;&#x7D20;&#x7684;&#x8DDD;&#x79BB;&#xFF0C;</p>
<p>chrome&#xFF1A;offsetLeft=&#x5B9A;&#x4F4D;&#x7956;&#x5148;&#x5DE6;&#x8FB9;&#x6846;&#x5BBD;&#x5EA6;+&#x5B9A;&#x4F4D;&#x7956;&#x5148;&#x5143;&#x7D20;&#x5DE6;&#x5185;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;+&#x5DE6;&#x4F4D;&#x79FB;+&#x5DE6;&#x5916;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;</p>
<p>ie6/7/8/9/10&#x3001;firefox&#xFF1A;offsetLeft=&#x5B9A;&#x4F4D;&#x7956;&#x5148;&#x5143;&#x7D20;&#x5DE6;&#x5185;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;+&#x5DE6;&#x4F4D;&#x79FB;+&#x5DE6;&#x5916;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;&#x3002;</p>
<p>chrome&#x6BD4;&#x5176;&#x4ED6;&#x6D4F;&#x89C8;&#x5668;&#x591A;&#x8BA1;&#x7B97;&#x4E86;&#x5B9A;&#x4F4D;&#x7956;&#x5148;&#x5143;&#x7D20;&#x7684;&#x8FB9;&#x6846;&#x3002;offsetTop&#x540C;&#x7406;&#x3002;</p>
<p>&#x517C;&#x5BB9;&#xFF1A;chrome&#x3001;firefox&#x3001;ie6/7/8/9/10&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF08;&#x5BBD;&#x5EA6;&#x548C;&#x9AD8;&#x5EA6;&#x90FD;&#x4E3A;100px&#xFF0C;&#x8FB9;&#x6846;&#x4E3A;50px&#xFF0C;&#x5185;&#x8FB9;&#x8DDD;&#x4E3A;60px&#xFF0C;&#x5916;&#x8FB9;&#x8DDD;&#x4E3A;70px&#xFF0C;&#x5DE6;&#x3001;&#x4E0A;&#x4F4D;&#x79FB;&#x4E3A;80px&#xFF0C;&#x6EDA;&#x52A8;&#x6761;&#x7684;&#x5BBD;&#x5EA6;&#x56E0;&#x7CFB;&#x7EDF;&#x4E0D;&#x540C;&#x800C;&#x4E0D;&#x540C;&#xFF09;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x4EE5;&#x6700;&#x8FD1;&#x7684;&#x5B9A;&#x4F4D;&#x7956;&#x5148;&#x5143;&#x7D20;&#x4E3A;&#x51C6;</span>
<span class="hljs-comment">// &#x8C37;&#x6B4C;=&gt;parentBorderLeftWidth+parentPaddingLeftWidth+left+marginLeft</span>
<span class="hljs-comment">// &#x5176;&#x4ED6;=&gt;parentPaddingLeftWidth+left+marginLeft</span>
alert(oDemo.offsetLeft);
<span class="hljs-comment">// chrome=&gt;20+10+80+70=180</span>
<span class="hljs-comment">// ie6/7/8/9/10/firefox=&gt;160</span>

<span class="hljs-comment">// &#x4EE5;&#x6700;&#x8FD1;&#x7684;&#x5B9A;&#x4F4D;&#x7956;&#x5148;&#x5143;&#x7D20;&#x4E3A;&#x51C6;</span>
<span class="hljs-comment">// &#x8C37;&#x6B4C;=&gt;parentBorderTopWidth+parentPaddingTopWidth+left+marginLeft</span>
<span class="hljs-comment">// &#x5176;&#x4ED6;=&gt;parentBorderTopWidth+left+marginLeft</span>
alert(oDemo.offsetLeft);
<span class="hljs-comment">// chrome=&gt;20+10+80+70=180</span>
<span class="hljs-comment">// ie6/7/8/9/10/firefox=&gt;160</span>
</code></pre>
<h2 id="45&#x3001;elementscrollwidthscrollheight">4.5&#x3001;element.scrollWidth/scrollHeight</h2>
<p>&#x63CF;&#x8FF0;&#xFF1A;&#x8BA1;&#x7B97;&#x65B9;&#x6CD5;&#x5982;&#xFF0C;</p>
<ul>
<li>&#x6709;&#x6EDA;&#x52A8;&#x6761;&#x65F6;&#xFF1A;<ul>
<li>chrome&#x3001;firefox&#x3001;ie8/9/10&#xFF1A;&#x5DE6;&#x5185;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;+&#x5185;&#x5BB9;&#x5BBD;&#x5EA6;&#x3002;</li>
<li>ie6/7&#xFF1A;&#x5DE6;&#x5185;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;+&#x5185;&#x5BB9;&#x5BBD;&#x5EA6;+&#x53F3;&#x5185;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;&#xFF08;&#x662F;&#x7531;<a href="http://caibaojian.com/css3/" target="_blank">CSS</a>&#x7684;BUG&#x5F15;&#x8D77;&#xFF09;&#x3002;</li>
</ul>
</li>
<li>&#x65E0;&#x6EDA;&#x52A8;&#x6761;&#x65F6;&#xFF1A;&#x5DE6;&#x5185;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;+&#x5BBD;&#x5EA6;+&#x53F3;&#x5185;&#x8FB9;&#x8DDD;&#x5BBD;&#x5EA6;&#x3002;</li>
</ul>
<p>&#x517C;&#x5BB9;&#xFF1A;chrome&#x3001;firefox&#x3001;ie8/9/10&#x3001;ie6/7&#xFF08;&#x534A;&#x517C;&#x5BB9;&#xFF09;&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF08;&#x5BBD;&#x5EA6;&#x548C;&#x9AD8;&#x5EA6;&#x90FD;&#x4E3A;100px&#xFF0C;&#x8FB9;&#x6846;&#x4E3A;50px&#xFF0C;&#x5185;&#x8FB9;&#x8DDD;&#x4E3A;60px&#xFF0C;&#x5916;&#x8FB9;&#x8DDD;&#x4E3A;70px&#xFF0C;&#x5DE6;&#x3001;&#x4E0A;&#x4F4D;&#x79FB;&#x4E3A;80px&#xFF0C;&#x6EDA;&#x52A8;&#x6761;&#x7684;&#x5BBD;&#x5EA6;&#x56E0;&#x7CFB;&#x7EDF;&#x4E0D;&#x540C;&#x800C;&#x4E0D;&#x540C;&#xFF0C;&#x5185;&#x5BB9;&#x5BBD;&#x5EA6;&#x548C;&#x9AD8;&#x5EA6;&#x90FD;&#x4E3A;200px&#xFF09;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x6709;&#x6EDA;&#x52A8;&#x6761;=paddingLeftWidth+contentWidth</span>
<span class="hljs-comment">// &#x6709;&#x6EDA;&#x52A8;&#x6761;(ie6/7)=paddingLeftWidth+contentWidth+paddingRightWidth</span>
<span class="hljs-comment">// &#x65E0;&#x6EDA;&#x52A8;&#x6761;=paddingLeftWidth+width+paddingRightWidth</span>
alert(oDemo.scrollWidth);
<span class="hljs-comment">// &#x6709;&#x6EDA;&#x52A8;&#x6761;=&gt;200+60=260</span>
<span class="hljs-comment">// &#x6709;&#x6EDA;&#x52A8;&#x6761;(ie6/7)=&gt;200+60+60=320</span>
<span class="hljs-comment">// &#x65E0;&#x6EDA;&#x52A8;&#x6761;=&gt;100+60+60=220</span>

<span class="hljs-comment">// &#x6709;&#x6EDA;&#x52A8;&#x6761;=paddingTopWidth+contentWidth</span>
<span class="hljs-comment">// &#x6709;&#x6EDA;&#x52A8;&#x6761;(ie6/7)=paddingTopWidth+contentWidth+paddingBottomWidth</span>
<span class="hljs-comment">// &#x65E0;&#x6EDA;&#x52A8;&#x6761;=paddingTopWidth+width+paddingBottomWidth</span>
alert(oDemo.scrollHeight);
<span class="hljs-comment">// &#x6709;&#x6EDA;&#x52A8;&#x6761;=&gt;60+200=260</span>
<span class="hljs-comment">// &#x6709;&#x6EDA;&#x52A8;&#x6761;(ie6/7)=&gt;60+200+60=320</span>
<span class="hljs-comment">// &#x65E0;&#x6EDA;&#x52A8;&#x6761;=&gt;60+100+60=220</span>
</code></pre>
<h2 id="46&#x3001;elementscrollleftscrolltop">4.6&#x3001;element.scrollLeft/scrollTop</h2>
<p>&#x63CF;&#x8FF0;&#xFF1A;&#x83B7;&#x5F97;&#x6C34;&#x5E73;&#x3001;&#x5782;&#x76F4;&#x6EDA;&#x52A8;&#x6761;&#x7684;&#x8DDD;&#x79BB;&#x3002;</p>
<p>&#x517C;&#x5BB9;&#xFF1A;chrome&#x3001;firefox&#x3001;ie6/7/8/9/10&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF08;&#x5BBD;&#x5EA6;&#x548C;&#x9AD8;&#x5EA6;&#x90FD;&#x4E3A;100px&#xFF0C;&#x8FB9;&#x6846;&#x4E3A;50px&#xFF0C;&#x5185;&#x8FB9;&#x8DDD;&#x4E3A;60px&#xFF0C;&#x5916;&#x8FB9;&#x8DDD;&#x4E3A;70px&#xFF0C;&#x5DE6;&#x3001;&#x4E0A;&#x4F4D;&#x79FB;&#x4E3A;80px&#xFF0C;&#x6EDA;&#x52A8;&#x6761;&#x7684;&#x5BBD;&#x5EA6;&#x56E0;&#x7CFB;&#x7EDF;&#x4E0D;&#x540C;&#x800C;&#x4E0D;&#x540C;&#xFF09;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">document</span>.onclick=<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-comment">// &#x6C34;&#x5E73;&#x6EDA;&#x52A8;&#x6761;&#x5DE6;&#x8DDD;&#x79BB;</span>
    alert(oDemo.scrollLeft);

    <span class="hljs-comment">// &#x5782;&#x76F4;&#x6EDA;&#x52A8;&#x6761;&#x4E0A;&#x8DDD;&#x79BB;</span>
    alert(oDemo.scrollTop);
}
</code></pre>
<h2 id="5&#x3001;&#x603B;&#x7ED3;">5&#x3001;&#x603B;&#x7ED3;</h2>
<p>&#x56E0;&#x4E3A;document.documentElement&#x5C31;&#x662F;&#x6D4F;&#x89C8;&#x5668;&#x7684;html&#x6807;&#x7B7E;&#xFF0C;&#x6240;&#x4EE5;&#x83B7;&#x53D6;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x76F8;&#x5173;&#x5C5E;&#x6027;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x7528;&#x8BE5;&#x5BF9;&#x8C61;&#x6765;&#x83B7;&#x53D6;&#x3002;</p>
<p>&#x5C4F;&#x5E55;&#x5BBD;&#x5EA6;&#xFF1A;window.screen.width&#x3002;</p>
<p>&#x6D4F;&#x89C8;&#x5668;&#x5185;&#x5BBD;&#x5EA6;&#xFF1A;window.innerWidth || document.documentElement.clientWidth&#x3002;</p>
<p>&#x5143;&#x7D20;&#x5185;&#x5BB9;&#x5BBD;&#x5EA6;&#xFF1A;element.clientWidth&#x3002;</p>
<p>&#x5143;&#x7D20;&#x5360;&#x4F4D;&#x5BBD;&#x5EA6;&#xFF1A;element.offsetWidth&#x3002;</p>
<p>&#x5143;&#x7D20;&#x76F8;&#x5BF9;&#x4F4D;&#x7F6E;&#xFF1A;&#x65E0;&#x3002;</p>
<p>&#x539F;&#x6587;&#x6765;&#x81EA;&#xFF1A;<strong>&#x300A;JS&#x5B66;&#x4E60;13&#xFF1A;screen/client/offset/scroll/inner/avail&#x7684;width/left&#x300B;</strong></p>
<h5 id="&#x6587;&#x7AE0;&#x76EE;&#x5F55;">&#x6587;&#x7AE0;&#x76EE;&#x5F55;</h5>
<p> &#x539F;&#x6587;&#xFF1A;<a href="http://caibaojian.com/js-name.html" target="_blank">JavaScript&#x6982;&#x5FF5;&#x4E4B;screen/client/offset/scroll/inner/avail&#x7684;width/left</a> &#xFF0C;&#x672A;&#x7ECF;&#x8BB8;&#x53EF;&#xFF0C;&#x7981;&#x6B62;&#x8F6C;&#x8F7D;&#x3002;
 &#x6765;&#x6E90;&#xFF1A;&#x524D;&#x7AEF;&#x5F00;&#x53D1;&#x535A;&#x5BA2; (<a href="http://caibaojian.com/js-name.html" target="_blank">http://caibaojian.com/js-name.html</a>)</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="JavaScript setInterval函数详解.html" class="navigation navigation-prev " aria-label="Previous page: JavaScript setInterval() 函数详解">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="js获取星期几.html" class="navigation navigation-next " aria-label="Next page: js获取星期几">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"JavaScript概念之screenclientoffsetscrollinneravail的widthleft","level":"1.11","depth":1,"next":{"title":"js获取星期几","level":"1.12","depth":1,"path":"project/js获取星期几.md","ref":"project/js获取星期几.md","articles":[]},"previous":{"title":"JavaScript setInterval() 函数详解","level":"1.10","depth":1,"path":"project/JavaScript setInterval函数详解.md","ref":"project/JavaScript setInterval函数详解.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"project/JavaScript概念之screenclientoffsetscrollinneravail的widthleft.md","mtime":"2019-06-16T10:42:26.061Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-07-18T03:07:23.077Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

